*** Settings ***
Library    SSHLibrary
Library    OperatingSystem

*** Variables ***
${HOST}         127.0.0.1
${USERNAME}     Administrator
${PASSWORD}     Admin@90000
${PROMPT}       $                  # 替换为你的系统提示符
${TIMEOUT}      40s

*** Test Cases ***
Test IPMCGet Version Command
    [Documentation]    测试 ipmcget --d v 命令是否能正确返回版本信息
    Open SSH Connection
    Execute IPMCGet Version Command
    Close SSH Connection

*** Keywords ***
Open SSH Connection
    [Documentation]    建立SSH连接
    Open Connection     ${HOST}    timeout=${TIMEOUT}
    Login               ${USERNAME}    ${PASSWORD}    delay=1s
    Set Client Configuration    prompt=${PROMPT}
    Set Client Configuration    timeout=${TIMEOUT}

Execute IPMCGet Version Command
    [Documentation]    执行ipmcget --d v命令并验证输出
    ${output}=         Execute Command    ipmcget -d v
    Log                Command output: ${output}
    
    # 验证命令是否执行成功（根据实际输出调整验证条件）
    Should Not Be Empty    ${output}
    Should Contain         ${output}    Version
    Should Contain         ${output}    BMC
    
    # 如果需要更详细的验证，可以添加更多检查点
    # 例如：Should Match Regexp    ${output}    \\d+\\.\\d+\\.\\d+

Close SSH Connection
    [Documentation]    关闭SSH连接
    Close All Connections